Skip to content

Add Maybe-returning tryGetOrCreateAsMaybe to Hashtable and FlatHashtable - #12335

Closed
dougqh wants to merge 3 commits into
feat/hashtable-api-unificationfrom
dougqh/hashtable-maybe
Closed

Add Maybe-returning tryGetOrCreateAsMaybe to Hashtable and FlatHashtable#12335
dougqh wants to merge 3 commits into
feat/hashtable-api-unificationfrom
dougqh/hashtable-maybe

Conversation

@dougqh

@dougqh dougqh commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • ./gradlew :internal-api:compileJava :internal-api:compileTestJava :dd-trace-core:compileTestJava succeeds
  • Unit tests in HashtableD1Test, HashtableD2Test, FlatHashtableD1Test, FlatHashtableD2Test cover present/absent-at-capacity behavior of both tryGetOrCreate (Maybe) and tryGetOrCreateOrNull (nullable)
  • ./gradlew :internal-api:test (targeted Hashtable/FlatHashtable/Maybe tests) passes
  • ./gradlew spotlessApply run, no outstanding formatting diffs
  • JMH allocation check via the real CardinalityLimitReporter caller in Use the unified Hashtable API in client-side stats #12312 (pending that PR's rebase onto this one)

🤖 Generated with Claude Code

dougqh added 2 commits August 28, 2026 14:01
Maybe/MaybeTest/EscapeShapeBenchmark/MaybeUsagePatternsBenchmark, copied
verbatim from the merge-queued PR #12328, so this branch (stacked on
#12101) can add Maybe-returning Hashtable/FlatHashtable methods without
waiting on the queue. Drop this commit's contents in favor of master's
copy once this branch rebases past #12328 landing.
Additive siblings to tryGetOrCreate on Hashtable.D1/D2 and
FlatHashtable.D1/D2, wrapping the existing @Nullable-returning method in
a Maybe rather than changing its signature. Each delegates to the
existing tryGetOrCreate as its sole Maybe#of call site, keeping the
allocation-free shape Maybe's class javadoc requires.

Validates Maybe against a real caller: the client-side-stats PR
(#12312) stacked on top of this one converts CardinalityLimitReporter
to tryGetOrCreateAsMaybe(...).update(...).
@dougqh dougqh added tag: ai generated Largely based on code generated by an AI or LLM comp: core Tracer core type: feature Enhancements and improvements tag: no release notes Changes to exclude from release notes labels Aug 28, 2026
@datadog-official

This comment has been minimized.

… to tryGetOrCreateOrNull

Maybe becomes the primary get-or-create contract on Hashtable.D1/D2 and
FlatHashtable.D1/D2; the raw nullable form survives as an escape hatch under
a less-prominent name. Breaking change is affordable now: CardinalityLimitReporter
is the only production caller and is updated to the renamed OrNull method here
(the fused Maybe-based conversion lands separately in #12312).
@dd-octo-sts

dd-octo-sts Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.77 s 14.70 s [-0.4%; +1.3%] (no difference)
startup:insecure-bank:tracing:Agent 13.57 s 13.73 s [-1.9%; -0.4%] (maybe better)
startup:petclinic:appsec:Agent 17.50 s 17.39 s [-0.5%; +1.7%] (no difference)
startup:petclinic:iast:Agent 17.44 s 17.59 s [-1.7%; +0.1%] (no difference)
startup:petclinic:profiling:Agent 17.52 s 17.47 s [-1.2%; +1.7%] (no difference)
startup:petclinic:sca:Agent 17.43 s 17.29 s [-0.1%; +1.8%] (no difference)
startup:petclinic:tracing:Agent 16.74 s 16.66 s [-0.6%; +1.5%] (no difference)

Commit: ccf2f1b5 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@dougqh

dougqh commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #12101 (all three commits + the Maybe.update javadoc tweak cherry-picked onto feat/hashtable-api-unification: 553d81c, a129e7b, 4e5dabd, fe71bfe). Closing this stacked PR rather than merging separately.

@dougqh dougqh closed this Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant